package com.getword.mongodao;

import com.getword.domain.Video;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

public interface VideoRepository extends MongoRepository<Video, String>, VideoOperations {
    Video findVideoById(String id);
    // 搜索，根据视频标题、keywords搜索，分页查询
    @Query(fields = "{'title':1,'coverImg':1,'course':1}")
    Page<Video> findByTitleLikeOrKeywordsContaining(String title, String keyword, Pageable pageable);
}
